;
(function (win, doc) {
    // 默认参数配置
    var defaultSettings = {
        direction: 'right',
        color: 0x5ecfe2,
        opacity: 0.9,
        width: 200,
        height: 120
    };
    var PaintCameraCilent = /** @class */ (function () {
        function PaintCameraCilent(camNodeId, floorid, GIM, map, options) {
            var self = this;
            if (!camNodeId && !floorid && !GIM && !map) {
                throw new Error("please afferent parmas");
            }
            if (GIM.Points[camNodeId].Code != "camera") {
                throw 'please afferent camera nodeId';
            }
            self = Object.assign(self, defaultSettings, options);
            self.chaunveMap = map;
            var camPosition = {
                x: GIM.Points[camNodeId].x,
                y: GIM.Points[camNodeId].y,
                z: 80
            };
            var coords = [];
            if (self.direction == 'left') {
                coords = [{
                        x: camPosition.x - 40,
                        y: camPosition.y - (self.height / 2),
                        z: 5
                    }, {
                        x: camPosition.x - 40,
                        y: camPosition.y + (self.height / 2),
                        z: 5
                    }, {
                        x: camPosition.x - (40 + self.width),
                        y: camPosition.y + (self.height / 2),
                        z: 5
                    }, {
                        x: camPosition.x - (40 + self.width),
                        y: camPosition.y - (self.height / 2),
                        z: 5
                    }];
            }
            else if (self.direction == 'right') {
                coords = [{
                        x: camPosition.x + 40,
                        y: camPosition.y - (self.height / 2),
                        z: 5
                    }, {
                        x: camPosition.x + 40,
                        y: camPosition.y + (self.height / 2),
                        z: 5
                    }, {
                        x: camPosition.x + (40 + self.width),
                        y: camPosition.y + (self.height / 2),
                        z: 5
                    }, {
                        x: camPosition.x + (40 + self.width),
                        y: camPosition.y - (self.height / 2),
                        z: 5
                    }];
            }
            else if (self.direction == 'front') {
                coords = [{
                        x: camPosition.x - (self.height / 2),
                        y: camPosition.y - (40 + self.width),
                        z: 5
                    }, {
                        x: camPosition.x + (self.height / 2),
                        y: camPosition.y - (40 + self.width),
                        z: 5
                    }, {
                        x: camPosition.x + (self.height / 2),
                        y: camPosition.y - 40,
                        z: 5
                    }, {
                        x: camPosition.x - (self.height / 2),
                        y: camPosition.y - 40,
                        z: 5
                    }
                ];
            }
            else if (self.direction == 'behind') {
                coords = [{
                        x: camPosition.x - (self.height / 2),
                        y: camPosition.y + (40 + self.width),
                        z: 5
                    }, {
                        x: camPosition.x + (self.height / 2),
                        y: camPosition.y + (40 + self.width),
                        z: 5
                    }, {
                        x: camPosition.x + (self.height / 2),
                        y: camPosition.y + 40,
                        z: 5
                    }, {
                        x: camPosition.x - (self.height / 2),
                        y: camPosition.y + 40,
                        z: 5
                    }
                ];
            }
            var clientCamare =  this.genRecCilent(map, coords, floorid, self.color, self.opacity, camPosition);

            self.clientCamare = clientCamare;

            return self

        };
        /**
         * 私有方法 生产可视域
         */
        PaintCameraCilent.prototype.genRecCilent = function (map, coords, floorid, color, opacity, camPosition) {
            var clientCamare = [];
            // 增加块标注
            clientCamare[coords.length] = map.addPolygonMarker(coords, floorid, color, opacity);
            // 添加线标注，一共四条线  一共传入三个参数 第一个坐标点数组  第二个指定楼层  第三个线条颜色
            coords.forEach(function (e, index) {
                clientCamare[index] = map.addPathMarker([camPosition, {
                        x: e.x,
                        y: e.y,
                        z: 3
                    }], floorid, color);
            });
            return clientCamare;
        };
        /**
         * 清除可视域 传入生产可视域的标识数组
         */
        PaintCameraCilent.prototype.cleanCilent = function (clientCamare) {
            var _this = this;
            clientCamare.forEach(function (e) {
                _this.chaunveMap.removeMarker(e);
            });
        };
        return PaintCameraCilent;
    }());
    window.PaintCameraCilent = PaintCameraCilent;
})(window, document);
